Arithmetic Operation


Q11.

The following three 'C' language statements is equivalent to which single statement?y=y+1; z=x+y; x=x+1
GateOverflow

Q12.

If n has 3, then the statement a[++n]=n++;
GateOverflow

Q13.

What is the output of the following C program? #include < stdio.h > void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty is %o \n",shifty); }
GateOverflow

Q14.

How many lines of output does the following C code produce? #include < stdio.h > float i=2.0; float j=1.0; float sum = 0.0; main() { while (i/j > 0.001) { j+=j; sum=sum+(i/j); printf("%f\n", sum); } }
GateOverflow

Q15.

What is the output of the following C program? #include < stdio.h > #define SQR(x) (x*x) int main() { int a; int b=4; a=SQR(b+2); printf("%d\n",a); return 0; }
GateOverflow

Q16.

Suppose n and p are unsigned int variables in a C program. We wish to set p to ^nC_3. If n is large, which one of the following statements is most likely to set p correctly?
GateOverflow

Q17.

What is the output of the following program? Class Test { public static void main (String [] args) { int x = 0; int y = 0 for (int z = 0; z < 5; z++) { if((++x >2)||(++y > 2)) { x++; } } System.out.printIn (x+ "" + y); } }
GateOverflow

Q18.

Which combination of the integer variables x, y and z makes the variable a get the value 4 in the following expression? a = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)
GateOverflow

Q19.

What does the following code do? var a, b: integer; begin a:=a+b; b:=a-b; a:a-b; end;
GateOverflow

Q20.

In Java, after executing the following code what are the values of x, y and z? int x, y=10; z=12; x=y++ + z++;
GateOverflow